package cn.itsource.itsource.controller;

import cn.itsource.itsource.domain.Pet;
import cn.itsource.itsource.query.PetQuery;
import cn.itsource.itsource.service.IPetService;
import cn.itsource.itsource.util.PageList;
import cn.itsource.itsource.vo.PetVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/pet")
public class PetController {
    @Autowired
    private IPetService petService;


    @PostMapping("/findpage")
    public PageList findPage(@RequestBody PetQuery query){


        return petService.findPage(query);

    }

    @PostMapping("queryHomePage")
    public PageList queryHomePage(@RequestBody PetQuery query){
        return petService.queryHomePage(query);
    }

    @GetMapping("/{id}")
    public PetVo getDetailById(@PathVariable("id") Integer id) {
        return petService.getDetailById(id);
    }

    @GetMapping("/findpetbyid/{id}")
    public Pet findPetById(@PathVariable("id") Long id){
        return petService.findPetById(id);
    }


}
